<?php

class Application_Model_ContasReceber extends Zend_Db_Table_Abstract {

    protected $_name = 'contas_receber';
    protected $_primary = 'codigo';
    private static $instance;

    public static function getInstance() {
        if (!isset(self::$instance)) {
            self::$instance = new Application_Model_ContasReceber();
            return self::$instance;
        }
        return self::$instance;
    }

    public function insert($data) {
        parent::insert($data);
    }

    public function update(array $data, $where = '') {
        $where = 'atendimento = ' . $data['atendimento'];
        parent::update($data, $where);
    }

    public function getById($id) {
        return $this->fetchRow("codigo = " . $id ." and dt_exclusao is null");
    }
    
    public function remove($id){
        $parceria = $this->getById($id)->toArray();
        $where = ' codigo = ' .$id;
        $parceria['dt_exclusao'] = Zend_Date::now()->get('Y/M/d');
        parent::update($parceria, $where);
    }
 
}